// 小数转百分比
export function toPercent(value, precision = 1, min = 5) {
    let percentage = Math.max(value * 100, min).toString();
    let point = percentage.indexOf('.');
    if (point != -1) {
        //有小数点
        if (precision > 0) {
            return percentage.substr(0, point + 1 + precision) + '%';
        } else {
            return percentage.substr(0, point) + '%';
        }
    } else {
        //没有小数点
        if (precision > 0) {
            return percentage + '.' + '0'.repeat(precision) + '%';
        } else {
            return percentage + '%';
        }
    }
}
